package com.lq.learningTest.duoxiancheng;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class UseCallable implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        Thread.sleep(3000);
        return 111;
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask = new FutureTask<>(new UseCallable());
        System.out.println(1);
        new Thread(futureTask).start();
        System.out.println(2);


        System.out.println(futureTask.get());

        System.out.println(4);
        System.out.println(5);

    }
}
